package com.zhigongtech.tender.rest.sys.controller;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.zhigongtech.common.consts.JWTConst;
import com.zhigongtech.common.web.BaseController;
import com.zhigongtech.extension.web.vo.Message;
import com.zhigongtech.tender.sys.entity.User;
import com.zhigongtech.tender.sys.service.IUserService;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

/**
 * <p>
 * SYS_USER 系统用户 前端控制器
 * </p>
 *
 * @author Alan
 * @since 2019-05-28
 */
@RestController
@RequestMapping("/sys/user")
public class UserController extends BaseController {

	@Autowired
	private IUserService userService;
	
	@ApiImplicitParams({ 
		@ApiImplicitParam(paramType = "header", dataType = "String", 
				name = JWTConst.AUTH_HEADER_STRING, value = "JWT Token", required = true) 
		}) 
	@RequestMapping(name="/users", method= {RequestMethod.GET, RequestMethod.POST}  )
//	@RequiresPermissions("sys:mm:te")
	public Message getUsers() {
		Message msg = new Message();
		List<User> users = userService.list();
		msg.addData("users", users);
		return msg.ok(200, "成功");
	}
}

